hysop.symbolic.relational module¶
- class hysop.symbolic.relational.Add(*exprs)[source]¶
Bases:
ArithmeticRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.AddAugmentedAssignment(lhs, rhs)[source]¶
Bases:
AugmentedAssignment- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.ArithmeticRelation(*exprs)[source]¶
Bases:
NAryRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.Assignment(lhs, rhs)[source]¶
Bases:
BinaryRelationRepresents variable assignment for code generation.
- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.AugmentedAssignment(lhs, rhs)[source]¶
Bases:
AssignmentBase class for augmented assignments
- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.BinaryFunction(lhs, rhs)[source]¶
Bases:
NAryFunction- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.BinaryRelation(lhs, rhs)[source]¶
Bases:
NAryRelationRepresents relations bewteen 2 variables.
- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.DivAugmentedAssignment(lhs, rhs)[source]¶
Bases:
AugmentedAssignment- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.LogicalAND(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalEQ(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalGE(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalGT(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalLE(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalLT(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalNE(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalOR(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.LogicalRelation(*exprs)[source]¶
Bases:
NAryRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.LogicalXOR(*exprs)[source]¶
Bases:
LogicalRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.Max(lhs, rhs)[source]¶
Bases:
BinaryFunction- default_assumptions: ClassVar[StdFactKB] = {}¶
- property fname¶
- class hysop.symbolic.relational.Min(lhs, rhs)[source]¶
Bases:
BinaryFunction- default_assumptions: ClassVar[StdFactKB] = {}¶
- property fname¶
- class hysop.symbolic.relational.ModAugmentedAssignment(lhs, rhs)[source]¶
Bases:
AugmentedAssignment- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.Mul(*exprs)[source]¶
Bases:
ArithmeticRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.MulAugmentedAssignment(lhs, rhs)[source]¶
Bases:
AugmentedAssignment- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.NAryFunction(*exprs)[source]¶
Bases:
ExprRepresents relations bewteen n variables.
- default_assumptions: ClassVar[StdFactKB] = {}¶
- property fname¶
- property free_symbols¶
Return from the atoms of self those which are free symbols.
Not all free symbols are
Symbol(see examples)For most expressions, all symbols are free symbols. For some classes this is not true. e.g. Integrals use Symbols for the dummy variables which are bound variables, so Integral has a method to return all symbols except those. Derivative keeps track of symbols with respect to which it will perform a derivative; those are bound variables, too, so it has its own free_symbols method.
Any other method that uses bound variables should implement a free_symbols method.
Examples
>>> from sympy import Derivative, Integral, IndexedBase >>> from sympy.abc import x, y, n >>> (x + 1).free_symbols {x} >>> Integral(x, y).free_symbols {x, y}
Not all free symbols are actually symbols:
>>> IndexedBase('F')[0].free_symbols {F, F[0]}
The symbols of differentiation are not included unless they appear in the expression being differentiated.
>>> Derivative(x + y, y).free_symbols {x, y} >>> Derivative(x, y).free_symbols {x} >>> Derivative(x, (y, n)).free_symbols {n, x}
If you want to know if a symbol is in the variables of the Derivative you can do so as follows:
>>> Derivative(x, y).has_free(y) True
- property is_number¶
Returns True if
selfhas no free symbols and no undefined functions (AppliedUndef, to be precise). It will be faster thanif not self.free_symbols, however, sinceis_numberwill fail as soon as it hits a free symbol or undefined function.Examples
>>> from sympy import Function, Integral, cos, sin, pi >>> from sympy.abc import x >>> f = Function('f')
>>> x.is_number False >>> f(1).is_number False >>> (2*x).is_number False >>> (2 + Integral(2, x)).is_number False >>> (2 + Integral(2, (x, 1, 2))).is_number True
Not all numbers are Numbers in the SymPy sense:
>>> pi.is_number, pi.is_Number (True, False)
If something is a number it should evaluate to a number with real and imaginary parts that are Numbers; the result may not be comparable, however, since the real and/or imaginary part of the result may not have precision.
>>> cos(1).is_number and cos(1).is_comparable True
>>> z = cos(1)**2 + sin(1)**2 - 1 >>> z.is_number True >>> z.is_comparable False
See also
sympy.core.basic.Basic.is_comparable
- class hysop.symbolic.relational.NAryRelation(*exprs)[source]¶
Bases:
ExprRepresents relations bewteen n variables.
- default_assumptions: ClassVar[StdFactKB] = {}¶
- property free_symbols¶
Return from the atoms of self those which are free symbols.
Not all free symbols are
Symbol(see examples)For most expressions, all symbols are free symbols. For some classes this is not true. e.g. Integrals use Symbols for the dummy variables which are bound variables, so Integral has a method to return all symbols except those. Derivative keeps track of symbols with respect to which it will perform a derivative; those are bound variables, too, so it has its own free_symbols method.
Any other method that uses bound variables should implement a free_symbols method.
Examples
>>> from sympy import Derivative, Integral, IndexedBase >>> from sympy.abc import x, y, n >>> (x + 1).free_symbols {x} >>> Integral(x, y).free_symbols {x, y}
Not all free symbols are actually symbols:
>>> IndexedBase('F')[0].free_symbols {F, F[0]}
The symbols of differentiation are not included unless they appear in the expression being differentiated.
>>> Derivative(x + y, y).free_symbols {x, y} >>> Derivative(x, y).free_symbols {x} >>> Derivative(x, (y, n)).free_symbols {n, x}
If you want to know if a symbol is in the variables of the Derivative you can do so as follows:
>>> Derivative(x, y).has_free(y) True
- property is_number¶
Returns True if
selfhas no free symbols and no undefined functions (AppliedUndef, to be precise). It will be faster thanif not self.free_symbols, however, sinceis_numberwill fail as soon as it hits a free symbol or undefined function.Examples
>>> from sympy import Function, Integral, cos, sin, pi >>> from sympy.abc import x >>> f = Function('f')
>>> x.is_number False >>> f(1).is_number False >>> (2*x).is_number False >>> (2 + Integral(2, x)).is_number False >>> (2 + Integral(2, (x, 1, 2))).is_number True
Not all numbers are Numbers in the SymPy sense:
>>> pi.is_number, pi.is_Number (True, False)
If something is a number it should evaluate to a number with real and imaginary parts that are Numbers; the result may not be comparable, however, since the real and/or imaginary part of the result may not have precision.
>>> cos(1).is_number and cos(1).is_comparable True
>>> z = cos(1)**2 + sin(1)**2 - 1 >>> z.is_number True >>> z.is_comparable False
See also
sympy.core.basic.Basic.is_comparable
- property rel_op¶
- class hysop.symbolic.relational.Pow(*exprs)[source]¶
Bases:
ArithmeticRelation- default_assumptions: ClassVar[StdFactKB] = {}¶
- property rel_op¶
- class hysop.symbolic.relational.Round(a)[source]¶
Bases:
UnaryFunction- default_assumptions: ClassVar[StdFactKB] = {}¶
- property fname¶
- class hysop.symbolic.relational.SubAugmentedAssignment(lhs, rhs)[source]¶
Bases:
AugmentedAssignment- default_assumptions: ClassVar[StdFactKB] = {}¶
- class hysop.symbolic.relational.UnaryFunction(a)[source]¶
Bases:
NAryFunction- default_assumptions: ClassVar[StdFactKB] = {}¶